/*
 * @Author: 晴鸢. 3013433857@qq.com
 * @Date: 2025-10-15 15:15:24
 * @LastEditors: 晴鸢. 3013433857@qq.com
 * @LastEditTime: 2025-10-15 15:33:43
 * @FilePath: /Learn/udp/test.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include<iostream>
#include<string>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
std::string terminal="/dev/pts/3";
int OpenTerminal()
{
    int fd=open(terminal.c_str(),O_WRONLY);
    if(fd<0)
    {
        std::cerr<<"open terminal error"<<std::endl;
        return 1;
    }
    dup2(fd,2);//将输出流重定向到fd
    //printf("hello linux!\n");
    //close(fd);
    return 0;
}